<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | Bigotry <3162875@qq.com>                               |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\admin\controller;

/**
 * 首页控制器
 */
class Index extends AdminBase
{
    
    /**
     * 首页方法
     */
    public function index()
    {
        
        // 获取系统信息数据
        $index_data = $this->logicAdminBase->getIndexData();
        
        // 获取用户统计数据
        $userStats = $this->logicUser->getUserStats();
        
        // 获取VIP统计数据
        $vipStats = $this->logicVip->getVipStats();
        
        // 获取VIP订单统计数据
        $vipOrderStats = $this->logicVipOrder->getVipOrderStats();
        
        // 获取提现统计数据
        $withdrawStats = $this->logicWithdraw->getWithdrawStatistics();
        
        // 获取产品统计数据
        $productStats = $this->logicProduct->getProductStats();
        
        // 整合所有统计数据
        $stats = [
            'user' => $userStats,
            'vip' => $vipStats,
            'vip_order' => $vipOrderStats,
            'withdraw' => $withdrawStats['data'] ?? [],
            'product' => $productStats
        ];
        
        $this->assign('info', $index_data);
        $this->assign('stats', $stats);
        
        return $this->fetch('index');
    }
    

}
